$(function () {
    var postStart=true;
    $("#post").click(function (e) {
        e.preventDefault();

        if(postStart) {
            postStart=false;
            var msg = false;
            if (!$('#PruchaseTime').val()) {
                msg = '请选择购买时间';
            }
            if (!$('#PruchaseCity').val()) {
                msg = '请选择购买城市';
            }
            if (!$('#PruchasePrice').val()) {
                msg = '购买价格';
            }
            if (msg) {
                postStart=true;
                CommonJs.alert.show({
                    model: 'error',
                    title: msg
                });
            } else {
                $.ajax({
                    type: "POST",
                    url: "/request-conv/index.php?m=BindProduct&a=bind",
                    dataType: 'json',
                    data: {
                        "p_id": $('#p_id').val(),
                        "u_id": $('#u_id').val(),
                        "pu_purchase": $('#PruchaseTime').val(),
                        "pu_land": $('#PruchaseCity').val(),
                        "pu_channel": $('#PruchaseFun').val(),
                        "pu_price": $('#PruchasePrice').val(),
                        "Referee": $('#Referee').val()//,
                        // 'pu_placehold':$('#Placehold').val()
                    },
                    success: function (result) {
                        postStart=true;
                        if (result.Code == 200) {
                            if (CommonJs.cookie.get('u_id')) {
                                var alt = CommonJs.alert.show(Model_Date_Star.Success[9].login);
                            } else {
                                var alt = CommonJs.alert.show(Model_Date_Star.Success[9].notLogin);
                            }
                            alt.params.pane.find('.HrWx_GZ,.Model_Closed').click(function () {
                                window.location.href = "/";
                            });
                        }
                    },
                    error:function () {
                        postStart=true;
                    }
                });
            }
        }
    });
});